Page({
    data: {
        latitude: 0,
        longitude: 0,
        markers: []
    },
    chooseLocation: function () {
        var that = this;
        wx.chooseLocation({
            success: function (res) {
                var latitude = res.latitude;
                var longitude = res.longitude;
                var markers = [{
                    id: 1,
                    latitude: latitude,
                    longitude: longitude,
                    title: res.name,
                    iconPath: '/images/location.png',
                    width: 30,
                    height: 30
                }];
                console.log(markers)
                that.setData({
                    latitude: latitude,
                    longitude: longitude,
                    markers: markers
                });
            }
        })
    },
    onMarkerTap: function (e) {
        wx.showModal({
            title: this.data.markers[0].title,
            content: '经度：' + this.data.longitude + '，纬度：' + this.data.latitude,
            showCancel: false
        })
    }
})
